//
//  ConsulationNewReplyCell.m
//  EnvironmentalProtection
//
//  Created by HCreater on 2018/10/31.
//  Copyright © 2018年 HCreater. All rights reserved.
//

#import "ConsulationNewReplyCell.h"

@interface ConsulationNewReplyCell ()

/// viewModle
@property (nonatomic, readwrite, strong) ConsulationNewReplyCellModel *viewModel;

/// IBOutlet
@property (weak, nonatomic) IBOutlet UILabel* askLabel;
@property (weak, nonatomic) IBOutlet UILabel* answerLabel;
@property (weak, nonatomic) IBOutlet UILabel* timeLabel;
@property (weak, nonatomic) IBOutlet UILabel* nameLabel;
@property (weak, nonatomic) IBOutlet UILabel* answerNumLabel;
@property (weak, nonatomic) IBOutlet UIImageView* avatarImgView;

@end

@implementation ConsulationNewReplyCell

- (void)awakeFromNib
{
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

#pragma mark - bind data
- (void)bindViewModel:(ConsulationNewReplyCellModel *)viewModel
{
    self.viewModel = viewModel;
    
    @weakify(self);
    
    self.askLabel.text = self.viewModel.ask;
//    self.answerLabel.text = self.viewModel.answer;
    self.timeLabel.text = self.viewModel.time;
    self.nameLabel.text = self.viewModel.name;
    self.answerNumLabel.text = self.viewModel.answerNum;
    
    [self.avatarImgView yy_setImageWithURL:[NSURL URLWithString:self.viewModel.headimg] placeholder:MHImageNamed(@"placeholderLogo")];
    
    [[self rac_signalForSelector:@selector(layoutSubviews)] subscribeNext:^(id x)
    {
        @strongify(self);
        self.avatarImgView.layer.cornerRadius = self.avatarImgView.frame.size.height/2.0f;
        self.avatarImgView.layer.masksToBounds = YES;
    }];
}

@end
